﻿@using CSM_SQL;
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>社区超市</title>
    <!-- Latest Bootstrap min CSS -->
    <link rel="stylesheet" href="~/Content/assets/css/bootstrap.min.css" type="text/css">
    <!-- Dropdownhover CSS -->
    <link rel="stylesheet" href="~/Content/assets/css/bootstrap-dropdownhover.min.css" type="text/css">
    <!-- latest fonts awesome -->
    <link rel="stylesheet" href="~/Content/assets/font/css/font-awesome.min.css" type="text/css">
    <!-- simple line fonts awesome -->
    <link rel="stylesheet" href="~/Content/assets/simple-line-icon/css/simple-line-icons.css" type="text/css">
    <!-- stroke-gap-icons -->
    <link rel="stylesheet" href="~/Content/assets/stroke-gap-icons/stroke-gap-icons.css" type="text/css">
    <!-- Animate CSS -->
    <link rel="stylesheet" href="~/Content/assets/css/animate.min.css" type="text/css">
    <!-- Style CSS -->
    <link rel="stylesheet" href="~/Content/assets/css/style.css" type="text/css">
    <!--  baguetteBox -->
    <link rel="stylesheet" href="~/Content/assets/css/baguetteBox.css">
    <!-- Owl Carousel Assets -->
    <link href="~/Content/assets/owl-carousel/owl.carousel.css" rel="stylesheet">
    <link href="~/Content/assets/owl-carousel/owl.theme.css" rel="stylesheet">


    <link rel="stylesheet" href="~/Content/assets/css/slider.css" type="text/css">
    <!-- Owl Carousel Assets -->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    @*<script src="~/Scripts/bootstrap.min.js"></script>
        <script src="~/Scripts/bootstrap.js"></script>*@
</head>

<body>
    <!--  Preloader  -->
    <div id="preloader">
        <div id="loading">
        </div>
    </div>
    <header>
        <!--  top-header  -->
        <div class="top-header" style="position:fixed;top:0;margin-bottom:20px; z-index:999">
            <div class="container">

                <div class="col-md-6">
                    <div class="top-header-left">
                        <ul>

                            <li>

                                <span>欢迎光临社区超市网上商城</span>
                            </li>
                            @{ var CurrUser = (Customer)HttpContext.Current.Session["CurrUser"];}
                            @if (CurrUser == null)
    {
                        <li>
                            <span>游客，请<a href="/Login/Login">登录</a></span>
                        </li>
}
                            @if (CurrUser != null)
    {
                        <li>
                            <span><i class="icon-user icons" aria-hidden="true"></i>@CurrUser.Name</span>
                        </li>
}

                        </ul>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="top-header-right">
                        <ul >
                            @if (CurrUser != null)
    {
                        <li><i class="icon-map icons" aria-hidden="true"></i>@CurrUser.Address </li>
                        <li><a href="/Login/EditPerson"><i class="icon-book-open icons" aria-hidden="true"></i> 个人信息</a></li>
                        <li><a href="/Login/Exit"><i class="icon-exclamation icons" aria-hidden="true"></i> 退出登录 </a></li>
}
                            @if (CurrUser == null)
                            {
                                <li ><p >没有账号？请<a href="/Login/Register">注册</a></p></li>
                            }

                        </ul>
                    </div>
                </div>
            </div>
            <!--  /top-header  -->
        </div>
        <section class="top-md-menu" style="margin-top:50px">
            <div class="container">
                <div class="col-sm-3">
                    <div class="logo">
                        <h6><img src="~/Content/img/Logo1.jpg" alt="logo" width="200" height="100" /></h6>
                    </div>
                </div>
                <div class="col-sm-6">
                    <!-- Search box Start -->
                    <form>
                        <div class="well carousel-search hidden-phone">
                            <div class="btn-group ">
                                <a id="searchType" class="btn dropdown-toggle btn-select" data-toggle="dropdown" href="#">所有 <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">零食&饮料</a></li>
                                    <li><a href="#">电子&数码</a></li>
                                    <li><a href="#" )>厨卫&家居</a></li>
                                    <li><a href="#">水果&干果</a></li>
                                    <li class="divider"></li>
                                    <li><a href="#">其他</a></li>

                                </ul>
                            </div>
                            <div class="search">
                                <input type="text" id="searchTxt" placeholder="商品名" />
                            </div>
                            <div class="btn-group">
                                <button type="button" id="btnSearch" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>
                            </div>
                        </div>
                    </form>
                    <!-- Search box End -->
                </div>
                <div class="col-sm-3">
                    <!-- cart-menu -->
                    <div class="cart-menu">
                        <ul>
                            <li class="dropdown">
                                @if (CurrUser != null)
    {
                                <a href="/Home/Cart" >
                                    <i class="icon-basket-loaded icons" aria-hidden="true"></i>
                                    <span class="subno" id="cart_icon">0</span><strong>购物车</strong>
                                </a>

        }
                            </li>
                        </ul>
                    </div>
                    <!-- cart-menu End -->
                </div>
                <div class="main-menu">
                    <!--  nav  -->
                    <nav class="navbar navbar-inverse navbar-default">
                        <!-- Brand and toggle get grouped for better mobile display -->
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                        </div>
                        <!-- Collect the nav links, forms, and other content for toggling -->
                        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" data-hover="dropdown" data-animations=" fadeInLeft fadeInUp fadeInRight">
                            <ul class="nav navbar-nav">
                                <li class="all-departments dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span> 商品分类</span> <i class="fa fa-bars" aria-hidden="true"></i> </a>
                                    <ul class="dropdown-menu dropdownhover-bottom all-departments" style="background-color:aliceblue" role="menu">
                                        <li class="dropdown">
                                            <a href=@Url.Action("Grid","Home",new { id=0})><img src="~/Content/assets/images/menu-icon2.png" alt="menu-icon2" /> 零食 & 饮料 <i class="fa fa-angle-right" aria-hidden="true"></i></a>
                                        </li>
                                        <li class="dropdown">
                                            <a href=@Url.Action("Grid","Home",new { id=1})><img src="~/Content/assets/images/menu-icon1.png" alt="menu-icon1" /> 电子 & 数码 <i class="fa fa-angle-right" aria-hidden="true"></i></a>
                                        </li>
                                        <li>
                                            <a href=@Url.Action("Grid","Home",new { id=2})><img src="~/Content/assets/images/menu-icon3.png" alt="menu-icon3" /> 厨卫 & 家具 @*<sup class="bg-red">hot!</sup>*@</a>
                                        </li>
                                        <li class="dropdown">
                                            <a href=@Url.Action("Grid","Home",new { id=3})><img src="~/Content/assets/images/menu-icon4.png" alt="menu-icon4" /> 水果 & 干果 <i class="fa fa-angle-right" aria-hidden="true"></i></a>
                                        </li>
                                        <li class="dropdown">
                                            <a href=@Url.Action("Grid","Home",new { id=4})><img src="~/Content/assets/images/menu-icon11.png" alt="menu-icon11" /> 其他 <i class="fa fa-angle-right" aria-hidden="true"></i></a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a href=@Url.Action("Home","Home")><h3 style="color:slategray">首页</h3></a></li>
                                <li><a href=@Url.Action("Tasks","Home")><h3 style="color:slategray">任务</h3></a></li>
                                <li><a href=@Url.Action("Cart","Home")><h3 style="color:slategray">购物车</h3></a></li>
                                <li><a href=@Url.Action("History","Home")><h3 style="color:slategray">已购买</h3></a></li>
                                <li><a href=@Url.Action("Evaluate","Home")><h3 style="color:slategray">评价</h3></a></li>
                               
                            </ul>
                            <!-- /.navbar-collapse -->
                        </div>
                    </nav>
                    <!-- /nav end -->
                </div>
            </div>
        </section>

        <!-- header-outer -->
        <!-- /header-outer -->
    </header>
    <div class="container body-content">
        @RenderBody()
        <hr />
    </div>
    <footer>
        <section class="newsletter">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-6 col-md-6">
                        <h3>
                            如果您有什么
                            <strong>建议</strong> &
                            <strong>想法</strong>

                        </h3>
                        <h3>
                            或是想
                            <strong>加入我们</strong>

                        </h3>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6">

                        <h1>请致电：<strong>123456789</strong></h1>
                    </div>
                </div>
            </div>
        </section>
    </footer>

    <p id="back-top">
        <a href="#top"><i class="fa fa-chevron-up" aria-hidden="true"></i></a>
    </p>
    <script src="~/Content/assets/js/jquery.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="~/Content/assets/js/bootstrap.min.js"></script>
    <script src="~/Content/assets/js/bootstrap-dropdownhover.min.js"></script>
    <!-- Plugin JavaScript -->
    <script src="~/Content/assets/js/jquery.easing.min.js"></script>
    <script src="~/Content/assets/js/wow.min.js"></script>
    <!-- owl carousel -->
    <script src="~/Content/assets/owl-carousel/owl.carousel.js"></script>
    <!--  Custom Theme JavaScript  -->
    <script src="~/Content/assets/js/custom.js"></script>
    <script src="~/Content/assets/js/filter-price.js"></script>
</body>

</html>
<script>
    $(function () {
        $.ajax({
            type: 'get',
            url: "/Home/CartNum",
            async: true,
            success: function (data) {
                if (data != 0) {
                    $("#cart_icon").text(data);
                }

            }
        });

        $("#btnSearch").click(function () {
            var type = -1;
            switch ($("#searchType").text()) {
                case '零食&饮料': type = 0; break;
                case '电子&数码': type = 1; break;
                case '厨卫&家居': type = 2; break;
                case '水果&干果': type = 3; break;
                case '其他': type = 4; break;
                default: type = -1; break;

            }
            var txt = $("#searchTxt").val();

            window.location.href = "/Home/Search?type=" + type + "&txt=" + txt;
            //$.ajax({
            //    type: 'get',
            //    url: '/Home/Search',
            //    data: { 'type': type, 'txt': $("#searchTxt").val() }
            //});
        });
    });

    function pick(id) {
        $.ajax({
            type: 'get',
            url: "/Home/Pick/" + id,
            async: true,
            success: function (data) {
                if (data != 0) {
                    $("#cart_icon").text(data);
                }
                else
                    alert("加入购物车失败，请先登录或购物车中是否已存在该商品。");
            }
        });
    }
</script>